///<reference path="References.js" />
if (window.Gorbatras === undefined) window.Gorbatras = {};   

Gorbatras.StartProgram = function()
{
    Gorbatras.Compatibility.CheckCompatibility();    

    //The scene that is passed around to few classes as a reference!  
    var m_scene = new Gorbatras.Scene( Gorbatras.HTMLTags.glcanvas );   
    
    if (m_scene !== null)
    {
        //Gorbatras.Sprite.InitPlane( m_scene.m_gl );
        Gorbatras.Geometry.SetupGeometries( m_scene.m_gl );

        //Intilizes the controls such as keyboard for the application
        var m_viewerControls = new Gorbatras.ViewerControls();
        m_viewerControls.Initilize( m_scene );
        
        var m_sceneSettingsView = new Gorbatras.SceneSettingsView( m_scene.m_sceneSettings );
        
        //Initilizes the toolbar
        var m_toolbar = new Gorbatras.Toolbarhandler();
        
        //Initilizes the modellist viewer picker
        var m_modelListView = new Gorbatras.ModelListView(m_scene); 
        
        //The buttons on the toolbar
        var m_toolbarButtons = new Gorbatras.ToolbarButtons( m_toolbar );
        
        //Time to init the toolbar buttons!
        m_toolbarButtons.InitButtons( m_modelListView, m_sceneSettingsView );
        //Create the pedestal
        new Gorbatras.Sprite( m_scene.m_gl, m_scene, [0, Gorbatras.Scene.PedestalHeight, 0], Gorbatras.Math.Vector3.EulerToQuaternion( [270, 0, 0] ), 8, Gorbatras.Paths.TextureFolder + "gray_tex.png" );
    }    
};